<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Attractions\Commerce\Request\Commerce_contract;

use Hyperf\Validation\Request\FormRequest;

/**
 * 合同验证数据类
 */
class CommerceContractRequest extends FormRequest
{

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            //商户id 验证
            'merchant_id' => 'required',
            //合同标题 验证
            'contract_title' => 'required',
            //甲方 验证
            'party_a' => 'required',
            //乙方 验证
            'party_b' => 'required',
            //生效日期 验证
            'effective_date' => 'required',
            //到期日期 验证
            'expiry_date' => 'required',

        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'contract_id' => '合同编号',
            'merchant_id' => '商户ID',
            'contract_title' => '合同标题',
            'party_a' => '甲方',
            'party_b' => '乙方',
            'sign_date' => '签订日期',
            'effective_date' => '生效日期',
            'expiry_date' => '到期日期',

        ];
    }

public function messages(): array
{
    return [
            'contract_id.required' => '必填合同编号',
            'merchant_id.required' => '必填商户ID',
            'contract_title.required' => '必填合同标题',
            'party_a.required' => '必填甲方',
            'party_b.required' => '必填乙方',
            'sign_date.required' => '必填签订日期',
            'effective_date.required' => '必填生效日期',
            'expiry_date.required' => '必填到期日期',

    ];
}
}